//创建 Sequelize 实例并进行数据库连接
const { Sequelize } = require('sequelize');
require('dotenv').config();

const sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USER, process.env.DB_PASS, {
  host: process.env.DB_HOST,
  dialect: 'mysql',
  define: {
    // 禁用默认的 id 主键
    defaultScope: {
      attributes: { exclude: [] },
    },
    // 设置每个模型都不自动添加 id, createdAt, updatedAt
    timestamps: false,
  }
});

module.exports = sequelize;